<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <link rel="stylesheet" href="/layui-v2.5.5/layui/css/layui.css" media="all">

</head>
<body>
<div style="margin: 200px auto; text-align: center; width: 360px;">
    <form class='layui-form' action='/sysUser/login'>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号:</label>
            <div class="layui-input-block">
                <input id="phone" type="text" name="phone" required  lay-verify="required" placeholder="输入手机号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="login">登录</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>`
</div>
<script src="/jquery/jquery-3.4.1.js"></script>
<script src="/layui-v2.5.5/layui/layui.all.js"></script>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(login)', function(data){
            var phone = $("#phone").val();

            $.ajax({
                type: "POST",
                url: "/sysUser/login",
                data: "phone="+phone,
                success: function(result){
                    if(result.flag){
                        location.href="/bOrderTerraceItem/getSaasOrders";
                    }else {
                        layer.alert(result.msg);
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>